package cn.hbu.zlfw.exchange.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;
/**
 * 
 * @ClassName: Poster 
 * @Description: 留言板主贴实体类
 * @author 王鹏伟<1223443289@qq.com>
 * @date 2017年12月19日 下午9:22:06 
 * @vsersion:v1.0
 */

import cn.hbu.zlfw.patent.entity.Patent;
@Entity
@Table(name="t_poster")
public class Poster implements Serializable{
	
	private static final long serialVersionUID = 2532414332048048506L;
	@Id
	@Column(name="id",length=32)
	@GeneratedValue(generator="UUID_KEY")
	@GenericGenerator(name="UUID_KEY",strategy="uuid.hex")
	private String id;
	
	@Column(name="userName",length=100,nullable=false)
	private String userName;
	
	@Column(name="userType",length=20,nullable=false)
	private Integer userType;
	
	@Column(name="schoolType",length=20,nullable=false)
	private Integer schoolType;
	@Column(name="department",length=80,nullable=false)
	private String department;
	@Column(name="title",nullable=false)
	private String title;
	
	@Column(name="content",nullable=false,length=1000)
	private String content;

	
	@ManyToOne(cascade= {CascadeType.MERGE,CascadeType.PERSIST})	//级联策略
	@JoinColumn(name="patent_id")
	private Patent patent;
	
	@OneToMany(mappedBy="poster")
	private Set<Replier> repliers;
	
	@Column(name="delState",length=20,nullable=false)
	private Integer delState;	//删除状态,1表示已经删除，0表示未删除
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="createTime",nullable=false)
	private Date createTime;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="updateTime",nullable=false)
	private Date updateTime;
	
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public Integer getUserType() {
		return userType;
	}

	public void setUserType(Integer userType) {
		this.userType = userType;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Patent getPatent() {
		return patent;
	}

	public void setPatent(Patent patent) {
		this.patent = patent;
	}

	public Integer getDelState() {
		return delState;
	}

	public void setDelState(Integer delState) {
		this.delState = delState;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	public Set<Replier> getRepliers() {
		return repliers;
	}

	public void setRepliers(Set<Replier> repliers) {
		this.repliers = repliers;
	}
	

	public Integer getSchoolType() {
		return schoolType;
	}

	public void setSchoolType(Integer schoolType) {
		this.schoolType = schoolType;
	}

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	@Override
	public String toString() {
		return "Poster [id=" + id + ", userName=" + userName + ", userType=" + userType + ", title=" + title
				+ ", content=" + content + ", delState=" + delState + ", createTime=" + createTime + ", updateTime="
				+ updateTime + "]";
	}
}
